import Main from "./Game";
import Ground from "./Ground";
import Tex from "./Tex";
import Tree from "./Tree";

// 赋予在小恐龙上的外部脚本
export default class TexRun extends Laya.Script {
    /** @prop { name: Game, tips:"", type: Node, default:null} */
    Game: Main;
    // 碰撞检测,
    onTriggerEnter(other, self) {
        // 检测是否为地面，地面时允许 Tex 进行跳跃
        if (other.owner instanceof Ground && self.owner instanceof Tex) {
            self.owner.changeJump(false);

            // 如果是 树的话,直接结束游戏
        } else if (other.owner instanceof Tree && self.owner instanceof Tex) {
            this.Game.GameOver();
        } else {
            console.log(other.owner.name);
        }
    }
}
